package cn.itcast.demo.client;

import cn.itcast.demo.client.fallback.UserClientFallbackFactory;
import cn.itcast.demo.config.DefaultFeignConfig;
import cn.itcast.demo.pojo.User;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

/**
 * 1.在接口上面加一个注解，声明调用的服务
 * 2.声明一个方法-控制器方法，方法三要素
 */
@FeignClient(value = "userservice",
        configuration = DefaultFeignConfig.class,
        fallbackFactory = UserClientFallbackFactory.class)
public interface UserClient {
    @GetMapping("/user/{id}")
    User findById(@PathVariable Long id);
}
